import axios from "axios";
import nprogress from "nprogress"
import "nprogress/nprogress.css"

let useaxios = axios.create({
    method:"get",
    baseURL:"http://localhost:3000",
    timeout:3000
    
})
// 请求拦截器

useaxios.interceptors.request.use((config)=>{
    nprogress.start()
    return config

})

useaxios.interceptors.response.use((value)=>{
    nprogress.done()
    return value.data

},(rej)=>{
    nprogress.done()
    console.log(rej.message);

    return new prompt(()=>{})
    })


export default useaxios